<%--
  Created by IntelliJ IDEA.
  User: sxjzit001
  Date: 2023/5/6
  Time: 14:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script>
        let jsonStr = '{"name": "zhangsan", "age": "18"}'
        // 将json字符串转换成js对象
        let jsonObj = JSON.parse(jsonStr)
        let name = jsonObj.name;
        let age = jsonObj.age;
        console.log("name是:",name,"   年龄是", age);

        // 将js对象转换成json字符串
        let jsonStr2 = JSON.stringify(jsonObj)
        console.log("jsonStr2的值是:",jsonStr2);
    </script>
</head>
<body>

</body>
</html>
